
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <fcntl.h>
#include "planificador.h"
#include "FuncionesPPD.h"
#include "Prueba-ArchConfig.h"
#include "consola.h"
#include "Socket-Server.h"
#include "Socket-Client.h"
#include "serializable.h"

int consolaHijo(int argc, char **argv) {

//int32_t sock = CreaConexionclient_UXIT(archPPD->puertoConsola);
	int32_t sock = CreaConexionclient_UXIT(argv[0]);
				char line[300 + 1];
			    char lineReciv[300 + 1];
			    char comando[301 ];
			    if(sock == -1){
			    	printf("ERROR CHILD, KILL");
			    	kill(0,1);
			    }
			    fgets(line, 301, stdin);
			    strncpy(comando, line, strpos(line, '\n'));
			   	while (strcmp(line, "exit") != 0){
			   		send(sock,line,strlen(line),MSG_CONFIRM);
			   		recv(sock,lineReciv, strlen(lineReciv),MSG_CONFIRM);
			    	fgets(line, 301, stdin);
			    	strncpy(comando, line, strpos(line, '\n'));
			    }


			   exit(0);



	return 1;
}
